<script setup lang="ts">
import { routeWhiteList } from "@/config/routes"
const router = useRouter()
const route = useRoute()
function onBack() {
  if (window.history.state.back)
    history.back()
  else
    router.replace('/')
}
const title = computed(() => {
  if (!route.meta)
    return ''

  return route.meta?.title as string || ''
})

const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route.name as string))
</script>

<template>
  <VanNavBar
    :title="title"
    :fixed="true"
    clickable placeholder
    :left-arrow="!showLeftArrow"
    @click-left="onBack"
  />
</template>
